<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>

<body>
<script>

var str1="Every man in the world! Every woman on earth!";
patt=/man/g;
str2=str1.replace(patt,"person");
document.write(str2+"<br />");
patt=/(wo)?man/g;
patt.compile(patt);
str2=str1.replace(patt,"person");
document.write(str2);


</script>
</body>
</html>
